package com.sun.umbrella.service.shiro.filter;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.web.filter.PathMatchingFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * @author Jay
 * @version v1.0
 * @description 权限校验类，校验是否有获取该资源的权限 TODO
 * @date 2017-12-06 12:48
 */
public class ServerAuthorizationFilter extends PathMatchingFilter {


    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {

        String username = (String) SecurityUtils.getSubject().getPrincipal();
        String url = this.getPathWithinApplication(request);
        return Boolean.TRUE;
    }
}
